import Vue from 'vue';
import { SvgIcon, navBack } from '../components'; // svg组件

// 阿里字体图标库 https://at.alicdn.com/t/**.css
// const iconfontUrl = `https://at.alicdn.com/t/font_1661272_lkv7ljqbg7f.css`;
const iconfontUrl = `https://at.alicdn.com/t/font_1661272_4204tn6zx4y.css`;
function iconfont(url) {
	const link = document.createElement('link');
	link.type = 'text/css';
	link.rel = 'stylesheet';
	link.href = url;
	document.getElementsByTagName('head')[0].appendChild(link);
}

if (iconfontUrl) {
	iconfont(iconfontUrl);
}

// register globally
Vue.component('svg-icon', SvgIcon);
Vue.component('nav-back', navBack);

const req = require.context('@/assets/icons/svg', false, /\.svg$/);
const requireAll = requireContext => requireContext.keys().map(requireContext);
requireAll(req);
